<form name="form_admin"  method="POST" action="" >
<input type="hidden" name="opt" value="updatephotos" />
<input type="hidden" name="Category" value="<?php echo $id?>" />
<table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
        <td width="10"></td>
        <td style="height: 30px;" valign="middle"><b>Background Home Page</b></td>
        <td>
        <textarea style="display:none"></textarea>
        </td>
    </tr>
    <tr>
    <td colspan="2">
		<table width="100%" cellpadding="4" cellspacing="1"id="tblsort">
			<tr class="headtb" nodrop="true" nodrag="true">
				<td width="5" ><?php echo _IMAGE?></td>
				<td width="300" ><?php echo _NAME?></td>
				<td width="20" ><?php echo _ACTIONS?></td>
				<td></td>
			</tr>
		</table>
        <input type="button" class="b1" onclick="tinyMCE.execCommand('mceTrImgC',{func:addrow})" value="Select Images">
		<input type="button" onclick="location.reload(true)" class="b1" id="breset"  value="<?php echo _RESET?>">
    </td>
    </tr>
</table>
</form>
<?php echo $show_page?>

<script>
var orderrow=0;
var addrow=function (obj)
{
    if(obj.id==undefined)obj.id=-1;
	tblroot=getId("tblsort").tBodies[0];
	var newtr=document.createElement("tr");
	newtr.className='row_'+(orderrow%2);
	var newtd=document.createElement("td");
	newtd.innerHTML="<img src='"+obj.r+obj.p+obj.f+"' width=30 height=30 onclick=\"openPI('file','"+obj.r+obj.p+obj.f+"',400,300)\">";
	newtr.appendChild(newtd);

	var newtd=document.createElement("td");
	var inputlname=document.createElement("input");
    var inputlid=document.createElement("input");
	inputlname.className="edit";
	inputlname.name="ListName[]";
    inputlname.value=obj.f;
    if(obj.n!=undefined)
    {
        inputlname.value=obj.n;
    };
	inputlname.onclick = function(){ this.select();};
    inputlid.type="hidden";
    inputlid.name="ListId[]";
    inputlid.value=obj.id;
	newtd.appendChild(inputlname);
    newtd.appendChild(inputlid);
	var inputImg=document.createElement("input");
	inputImg.type="hidden";
	inputImg.name="ListUrl[]";
	inputImg.value=obj.p+obj.f;
	newtd.appendChild(inputImg);
	newtr.appendChild(newtd);
    var inputor=Document.createElement("input");
    inputor.name="listorder[]";
    inputor.id="listorder_"+orderrow;
    inputor.type="hidden";
    inputor.value=orderrow;
    newtd.appendChild(inputor);
	var newtd=document.createElement("td");
	var newa=document.createElement("a");
	newa.innerHTML="delete";
	newa.style.cursor="pointer";
	newa.onclick=function()
	{
	   newtr.style.display='none';
       inputImg.value=-1;
	};
	newtd.appendChild(newa);
	newtr.appendChild(newtd);

	tblroot.appendChild(newtr);
	orderrow++;
};
<?
foreach($ListContent as $i=>$content)
{
    echo "addrow({id: ".$content['iId'].",n: '".$content['cName']."',r:'../".$folder_img_upload."',p:'',f:'".$content['cImage']."'});";
}
?>
</script>
<script type="text/javascript">
(new TableDnD).init("tblsort");
</script>